package com.bskj.common.bean.model;

import com.alibaba.fastjson.JSONObject;
import com.bskj.common.utils.EncryptUtil;

import java.util.Date;

/**
 * Created by mocaijin on 25/01/2018.
 */
public class UserCoupon extends BaseJSONModel {

    private Integer id;
    private Integer couponId;
    private String uuid;
    private Integer parkingLotCustomerId;
    private Integer money;
    private Date validDate;
    private Integer userId;
    private Integer shopId;
    private Integer status;
    private Date createTime; // 录入时间
    private Date updateTime; // 更新时间

    private Integer couponMoneyType = 1;
    
    private Integer validType;
    private String validTypeDesc;
    private Date expireDate;

    private ParkingLotCustomer parkingLotCustomer;
    private ParkingShop parkingShop;
    
    private Integer sweepCode;
    
    private Integer limitModeType;
    
    
    public Integer getSweepCode() {
		return sweepCode;
	}

	public void setSweepCode(Integer sweepCode) {
		this.sweepCode = sweepCode;
	}

	@Column
    public Integer getCouponMoneyType() {
		return couponMoneyType;
	}

	public void setCouponMoneyType(Integer couponMoneyType) {
		this.couponMoneyType = couponMoneyType;
	}

	@Column
    @Override
    public Integer getId() {
        return id;
    }

    @Override
    public void setId(Integer id) {
        this.id = id;
    }
    @Column
    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column
    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    @Column
    public Integer getCouponId() {
        return couponId;
    }

    public void setCouponId(Integer couponId) {
        this.couponId = couponId;
    }
    @Column
    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }
    @Column
    public Integer getParkingLotCustomerId() {
        return parkingLotCustomerId;
    }

    public void setParkingLotCustomerId(Integer parkingLotCustomerId) {
        this.parkingLotCustomerId = parkingLotCustomerId;
    }

    public Date getExpireDate() {
        return expireDate;
    }

    public void setExpireDate(Date expireDate) {
        this.expireDate = expireDate;
    }
    @Column
    public Integer getMoney() {
        return money;
    }

    public void setMoney(Integer money) {
        this.money = money;
    }
    @Column
    public Date getValidDate() {
        return validDate;
    }

    public void setValidDate(Date validDate) {
        this.validDate = validDate;
    }
    @Column
    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }
    @Column
    public Integer getShopId() {
        return shopId;
    }

    public void setShopId(Integer shopId) {
        this.shopId = shopId;
    }
    @Column
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getValidType() {
        return validType;
    }

    public void setValidType(Integer validType) {
        this.validType = validType;
    }

    public String getValidTypeDesc() {
        return validTypeDesc;
    }

    public void setValidTypeDesc(String validTypeDesc) {
        this.validTypeDesc = validTypeDesc;
    }

    public ParkingLotCustomer getParkingLotCustomer() {
        return parkingLotCustomer;
    }

    public void setParkingLotCustomer(ParkingLotCustomer parkingLotCustomer) {
        this.parkingLotCustomer = parkingLotCustomer;
    }

    public ParkingShop getParkingShop() {
        return parkingShop;
    }

    public void setParkingShop(ParkingShop parkingShop) {
        this.parkingShop = parkingShop;
    }
    
    public Integer getLimitModeType() {
		return limitModeType;
	}

	public void setLimitModeType(Integer limitModeType) {
		this.limitModeType = limitModeType;
	}

	public static UserCoupon toBean(String userCouponEncryptStr) throws Exception {
        String userCouponStr = EncryptUtil.decrypt(userCouponEncryptStr);
        UserCoupon userCoupon = JSONObject.parseObject(userCouponStr, UserCoupon.class);
        return userCoupon;
    }

    public String toEncryptJSONString() throws Exception {
    	JSONObject jsonObj = new JSONObject();
    	jsonObj.put("couponId", couponId);
    	jsonObj.put("createTime", createTime);
    	jsonObj.put("couponMoneyType", couponMoneyType);
    	jsonObj.put("money", money);
    	jsonObj.put("parkingLotCustomerId", parkingLotCustomerId);
    	jsonObj.put("shopId", shopId);
    	jsonObj.put("status", status);
    	jsonObj.put("uuid", uuid);
    	jsonObj.put("validDate", validDate);
    	jsonObj.put("validType", validType);
    	jsonObj.put("sweepCode", sweepCode);
    	jsonObj.put("limitModeType", limitModeType);
        return EncryptUtil.encrypt(jsonObj.toJSONString());
    }
}
